#include <iostream>
#include <unordered_set>
using namespace std;

int main() {
    string s1;
    string s2;
    getline(cin, s1);
    getline(cin, s2);
    unordered_set<char> set;
    for (auto c : s2)
    {
        set.insert(c);
    }
    auto it = s1.begin();
    while (it != s1.end())
    {
        if (set.count(*it))
            it = s1.erase(it);
        else
            ++it;
    }
    cout << s1 << endl;
    return 0;
}